package equipe2msvy.ProjectServeurApplication.beans;

import java.io.Serializable;
import java.sql.Date;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="OFFRE")
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="TYPE_OFFRE", length=1)
public class Offre implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID_OFFRE")
	private int idOffre;
	@Column(name="PRIX_DEBUT")
	private double prix_debut;
	@Column(name="DATE")
	private Date date;
	@ManyToOne
	@JoinColumn(name="ID_INVEST")
	private Investisseur investisseur;
	@ManyToOne
	@JoinColumn(name="ID_SOC")
	private Societe societe;
	@OneToMany(mappedBy ="offre" , fetch =FetchType.LAZY)
	private Collection<Contrat> contrats;
	@ManyToOne
	@JoinColumn(name="ID_TRANSAC")
	private Transaction transaction;
	public Offre(double prix_debut, Date date) {
		super();
		this.prix_debut = prix_debut;
		this.date = date;
	}
	public Offre() {
		super();
		// TODO Auto-generated constructor stub
	}
	public int getIdOffre() {
		return idOffre;
	}
	public void setIdOffre(int idOffre) {
		this.idOffre = idOffre;
	}
	public double getPrix_debut() {
		return prix_debut;
	}
	public void setPrix_debut(double prix_debut) {
		this.prix_debut = prix_debut;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public Investisseur getInvestisseur() {
		return investisseur;
	}
	public void setInvestisseur(Investisseur investisseur) {
		this.investisseur = investisseur;
	}
	public Societe getSociete() {
		return societe;
	}
	public void setSociete(Societe societe) {
		this.societe = societe;
	}
	public Collection<Contrat> getContrats() {
		return contrats;
	}
	public void setContrats(Collection<Contrat> contrats) {
		this.contrats = contrats;
	}
	public Transaction getTransaction() {
		return transaction;
	}
	public void setTransaction(Transaction transaction) {
		this.transaction = transaction;
	}
}
